ALMaSS  1.0
The Animal, Landscape and Man Simulation System
probe_data Class Reference

Data structure to hold & output probe data probe data is designed to be used to return the number of objects in a given area or areas in specific element or vegetation types or farms. More...

#include <PopulationManager.h>

Public Member Functions

void FileOutput (int No, int time, int ProbeNo)
 
void FileAppendOutput (int No, int time)
 
 probe_data ()
 
void SetFile (ofstream *F)
 
ofstream * OpenFile (char *Nme)
 
bool OpenForAppendToFile ()
 
void CloseFile ()
 
 ~probe_data ()
 

Public Attributes

bool m_FileRecord
 
unsigned m_ReportInterval
 
unsigned m_NoAreas
 
rectangle m_Rect [10]
 
unsigned m_NoEleTypes
 
unsigned m_NoVegTypes
 
unsigned m_NoFarms
 
TTypesOfVegetation m_RefVeg [25]
 
TTypesOfLandscapeElement m_RefEle [25]
 
unsigned m_RefFarms [25]
 
bool m_TargetTypes [10]
 

Protected Attributes

ofstream * m_MyFile
 
int m_Time
 
char m_MyFileName [255]
 

Detailed Description

Data structure to hold & output probe data probe data is designed to be used to return the number of objects in a given area or areas in specific element or vegetation types or farms.

Constructor & Destructor Documentation

◆ probe_data()

probe_data::probe_data ( )

Constructor for probe_data

1479  {
1480  m_Time = 0;
1481  m_FileRecord = false;
1482  m_MyFile = NULL;
1483 }
int m_Time
Definition: PopulationManager.h:287
ofstream * m_MyFile
Definition: PopulationManager.h:286
bool m_FileRecord
Definition: PopulationManager.h:290

◆ ~probe_data()

probe_data::~probe_data ( )

Destructor for probe_data

1513  {
1514 }

Member Function Documentation

◆ CloseFile()

void probe_data::CloseFile ( )
135  {
136  if ( m_MyFile != NULL ) {
137  if (m_MyFile->is_open()) m_MyFile->close();
138  delete m_MyFile;
139  }
140 };

Referenced by CloseDownSim().

◆ FileAppendOutput()

void probe_data::FileAppendOutput ( int  No,
int  time 
)
1462  {
1463  m_MyFile->open(m_MyFileName,ios::app);
1464  if ( !m_MyFile->is_open() ) {
1465  g_msg->Warn( (MapErrorState)0,"Cannot open file for append: ", m_MyFileName );
1466  exit( 0 );
1467  }
1468  if ( m_FileRecord ) {
1469  (*m_MyFile)<< time << '\t' << No << endl;
1470  }
1471  m_MyFile->close();
1472 }
void Warn(MapErrorState a_level, std::string a_msg1, std::string a_msg2)
Definition: maperrormsg.cpp:59
char m_MyFileName[255]
Definition: PopulationManager.h:288
class MapErrorMsg * g_msg
This pointer provides access the to the internal ALMaSS error message system.
Definition: maperrormsg.cpp:41
MapErrorState
Definition: maperrormsg.h:33

References g_msg, and MapErrorMsg::Warn().

◆ FileOutput()

void probe_data::FileOutput ( int  No,
int  time,
int  ProbeNo 
)

Basic output function of the default probe data file.
This just counts numbers in specified areas

1447  {
1448  if ( m_FileRecord ) {
1449 
1450  if ( ProbeNo == 0 ) {
1451  // First probe so write the time and a new line
1452  (*m_MyFile) << endl;
1453  (*m_MyFile) << time << '\t' << No;
1454  } else
1455  (*m_MyFile) << '\t' << No ;
1456  }
1457  (*m_MyFile).flush();
1458 }

Referenced by Skylark_Population_Manager::ProbeReportPOM().

◆ OpenFile()

ofstream * probe_data::OpenFile ( char *  Nme)

Opens the default probe data output file

1490  {
1491  m_MyFile = new ofstream( Nme );
1492  if ( !m_MyFile->is_open() ) {
1493  g_msg->Warn( (MapErrorState)0,"probe_data::OpenFile - Cannot open file: ", Nme );
1494  exit( 0 );
1495  }
1496  strcpy( m_MyFileName, Nme );
1497  return m_MyFile;
1498 }

References g_msg, and MapErrorMsg::Warn().

Referenced by GetProbeInput_ini().

◆ OpenForAppendToFile()

bool probe_data::OpenForAppendToFile ( )
inline
308  {
309  m_MyFile = new ofstream(m_MyFileName, ios::app);
310  if (!(*m_MyFile).is_open())
311  {
312  g_msg->Warn( WARN_FILE, "PopulationManager::AppendToFile() Unable to open file for append: ", m_MyFileName );
313  exit(1);
314  }
315  return true;
316  }
@ WARN_FILE
Definition: maperrormsg.h:37

References g_msg, m_MyFile, m_MyFileName, MapErrorMsg::Warn(), and WARN_FILE.

◆ SetFile()

void probe_data::SetFile ( ofstream *  F)

Sets the filename for the default probe data output

1504  {
1505  m_MyFile = F;
1506 }

Referenced by GetProbeInput_ini().

Member Data Documentation

◆ m_FileRecord

bool probe_data::m_FileRecord

◆ m_MyFile

ofstream* probe_data::m_MyFile
protected

Referenced by OpenForAppendToFile().

◆ m_MyFileName

char probe_data::m_MyFileName[255]
protected

Referenced by OpenForAppendToFile().

◆ m_NoAreas

◆ m_NoEleTypes

◆ m_NoFarms

◆ m_NoVegTypes

◆ m_Rect

◆ m_RefEle

◆ m_RefFarms

◆ m_RefVeg

◆ m_ReportInterval

unsigned probe_data::m_ReportInterval

◆ m_TargetTypes

bool probe_data::m_TargetTypes[10]

◆ m_Time

int probe_data::m_Time
protected

The documentation for this class was generated from the following files: